<?php
class Search_Content extends CI_Controller{
	function __construct()
	{
		parent::__construct();
		$this->load->library('zend', 'Zend/Search/Lucene');
		$this->load->library('zend');
		$this->zend->load('Zend/Search/Lucene');

	}

	function index()
	{
		$this->search();
	}

	function search()
	{
		$index = new Zend_Search_Lucene('index/perguntas_index');
		$q = mysql_real_escape_string( $_GET['q'] );
		$query =  $q;
		echo $query;
		$hit = $index->find($query);
		// 		return 'id: '. $hit->id .'<br />'.'titulo: '.$hit->titulo .'<br />'.'url: '.$hit->url .'<br />'.'descricao: '.$hit->descricao .'<br ><br />';
		return json_encode($hit);
	}
}